// pages/home/home.js
Page({

  /**
   * 页面的初始数据
   */
  data: {

    selectedIndex:0,
    tabName:[
        {index:0,name:'综合'},
        {index:1,name:'销量'},
        {index:2,name:'价格'},
        
    ],
    message:'动态数据',
    goodsList:[  "松下彩电","苏泊尔家用球釜电饭煲","美的家用电饭煲","九阳家用破壁机","格兰仕15L的微波炉","荣事达超过" ],
    goodsObjectList:[
      {name:"松下彩电",price:300.5,address:"黑龙江"} ,
      {name:"苏泊尔家用球釜电饭煲",price:30.5,address:"黑龙江"} ,
      {name:"美的家用电饭煲",price:500.5,address:"黑龙江"} ,
      {name:"九阳家用破壁机",price:600.5,address:"黑龙江"} ,
      {name:"格兰仕15L的微波炉",price:30.5,address:"黑龙江"} ,
      {name:"荣事达超过",price:700.5,address:"黑龙江"} ,
    ],
    goodsDitail:{
        name:'xxxx冰箱',
        price:5000,
        adress:'河北省石家庄市',
        gg:'1000cm*50cm*90cm'
    }

  },

  queryGoodsList(event){

    console.log("event",event)
    const {type } = event.target.dataset
    wx.showToast({
      title: '查询商品详情',
    })

      //js访问数据
    if(type == 1){
      let newArr = this.data.goodsList;
      newArr.push( "手扶拖拉机")
      //调用setData方法 让他更新UI 
      this.setData({
        goodsList:newArr
      })
    }else if(type== 2){
      let newArr = this.data.goodsObjectList;
      newArr.push( {name:"儿童自行车",price:400.5,address:"黑龙江"} ,)
      //调用setData方法 让他更新UI 
      this.setData({
        goodsObjectList:newArr
      })
    }
   

  }




})